//
//  XTEmoticonBtn.swift
//  Weibo(Swift)
//
//  Created by 肖霆 on 16/5/23.
//  Copyright © 2016年 肖霆. All rights reserved.
//

import UIKit

class XTEmoticonBtn: UIButton {

    var emoticon:XTEmoticon?{
        didSet{
            guard let etn = emoticon else {
                return
            }
            //让btn显示出来
            self.hidden = false
            if etn.type == "0"{
            //图片表情
                self.setTitle(nil, forState: .Normal)
                self.setImage(UIImage(named: etn.path!), forState: .Normal)
            }else if(etn.type == "1"){
            //emoji表情
                self.setTitle((etn.code! as NSString).emoji(), forState: .Normal)
                self.setImage(nil, forState: .Normal)
            
            }
        }
    
    }
}
